<%@ page contentType="text/html;charset=GBK"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="X-UA-Compatible" content="IE=8">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<title>AlternaTIFF scripting demo</title>

<script type="text/javascript" language="javascript">

function atif_OnOrientationChange(caller_id, newval)
{
	document.getElementById('orient_console').value=tiff0.GetValue(1);
}

function queryversion() {
	var bb = tiff0.GetVersion(0);
	alert("AlternaTIFF version " + bb);
}

function queryorient() {
	var q = tiff0.GetValue(1);
	alert("Orientation = " + q);
}

function queryneg() {
	var q = tiff0.GetValue(2);
	alert("Negative = " + q);
}

function queryresample() {
	var q = tiff0.GetValue(3);
	alert("Resample = " + q);
}

function querymousemode() {
	var q = tiff0.GetValue(4);
	alert("Mouse mode = " + q);
}

function querysizemode() {
	var q = tiff0.GetValue(5);
	alert("Size mode = " + q);
}

function queryfixedsize() {
	var q = tiff0.GetValue(6);
	alert("Size = " + q + "%");
}


function querypage()
{
	var p1=tiff0.GetCurrentPage();
	var pp=tiff0.GetNumberOfPages();
	alert("Page " +p1 + " of " + pp);
}

function querystate() {
	var s0=tiff0.GetState(0);
	var s1=tiff0.GetState(1);
	var s2=tiff0.GetState(2);
	var s3=tiff0.GetState(3);
	alert("ready="+s0+  "\nloadstate="+s1 +"\nimagestate="+s2 +"\nregistered="+s3);
}

</script>

<!-- A relay function to make this event work in IE.
  The conditional comment (or the equivalent) is needed because some
  browsers don't understand the "for" attribute, and would otherwise
  execute this code unconditionally. -->

<!--[if IE]>
<script language=JScript for=tiffobj0 event="OnOrientationChange(newmode)">
  if(typeof(atif_OnOrientationChange) == "function") {
    atif_OnOrientationChange('tiffobj0',newmode);
  }
</script>
<![endif]-->

<style id="style-1-cropbar-clipper">/* Copyright 2014 Evernote Corporation. All rights reserved. */
.en-markup-crop-options {
    top: 18px !important;
    left: 50% !important;
    margin-left: -100px !important;
    width: 200px !important;
    border: 2px rgba(255,255,255,.38) solid !important;
    border-radius: 4px !important;
}

.en-markup-crop-options div div:first-of-type {
    margin-left: 0px !important;
}
</style></head>

<body text="#000000" link="#0000c0" vlink="#800080" bgcolor="#ffffff">
<small>[<a href="http://www.alternatiff.com/">AlternaTIFF</a> ::
<a href="http://www.alternatiff.com/technical.html">Technical documentation</a> ::
<a href="http://www.alternatiff.com/scripting/">Scripting</a> :: Demo]</small>
<h2>AlternaTIFF scripting demo</h2>

<table border="0" cellpadding="4"><tbody><tr><td bgcolor="#c0c0c0">

<object id="tiffobj0" width="550" height="180" classid="clsid:106E49CF-797A-11D2-81A2-00E02C015623">
<param name="src" value="img/sample.tif">
<param name="enableevents" value="32">

 <embed id="tiffemb0" src="img/sample.tif" type="image/tiff" width="550" height="180" enableevents="32">
</object>

<script type="text/javascript" language="javascript">
  var tiff0;
  if(document.getElementById) {
    if(document.getElementById('tiffemb0')) {
      tiff0=document.getElementById('tiffemb0');
    }
    else if(document.getElementById('tiffobj0')) {
      tiff0=document.getElementById('tiffobj0');
    }
  }
  else if(document.all) {
    tiff0=document.all.tiffobj0;
  }
</script>

</td><td>


<table border="1">
<tbody><tr><td colspan="2">Scroll:</td><td></td><td align="center"><button onclick="tiff0.Scroll(1,3)">^^^</button></td></tr>
<tr><td colspan="3"></td><td align="center"><button onclick="tiff0.Scroll(1,2)">^^</button></td></tr>
<tr><td colspan="3"></td><td align="center"><button onclick="tiff0.Scroll(1,1)">^</button></td></tr>
<tr><td><button onclick="tiff0.Scroll(4,3)">&lt;&lt;&lt;</button></td>
<td><button onclick="tiff0.Scroll(4,2)">&lt;&lt;</button></td>
<td><button onclick="tiff0.Scroll(4,1)">&lt;</button></td><td></td>
<td><button onclick="tiff0.Scroll(2,1)">&gt;</button></td>
<td><button onclick="tiff0.Scroll(2,2)">&gt;&gt;</button></td>
<td><button onclick="tiff0.Scroll(2,3)">&gt;&gt;&gt;</button></td></tr>
<tr><td colspan="3"></td><td align="center"><button onclick="tiff0.Scroll(3,1)">v</button></td></tr>
<tr><td colspan="3"></td><td align="center"><button onclick="tiff0.Scroll(3,2)">vv</button></td></tr>
<tr><td colspan="3"></td><td align="center"><button onclick="tiff0.Scroll(3,3)">vvv</button></td></tr>
</tbody></table>


</td></tr></tbody></table>


Load:&nbsp;
<button onclick="tiff0.LoadImage(&#39;img/sample1.tif&#39;,1,0)">File 1</button>
<button onclick="tiff0.LoadImage(&#39;sample2.tif&#39;,1,0)">File 2 pg1</button>
<button onclick="tiff0.LoadImage(&#39;sample2.tif&#39;,3,0)">File 2 pg3</button>
<button onclick="tiff0.LoadImage(&#39;../sample.tif&#39;,1,0)">File 3</button>
<br>
Page:&nbsp;
<button onclick="tiff0.GoToPage(1)">1</button>
<button onclick="tiff0.GoToPage(2)">2</button>
<button onclick="tiff0.GoToPage(3)">3</button>
<button onclick="tiff0.GoToPage(4)">4</button>
<button onclick="tiff0.GoToPageSpecial(1)">|&lt;- First</button>
<button onclick="tiff0.GoToPageSpecial(3)">&lt;- Prev</button>
<button onclick="tiff0.GoToPageSpecial(4)">Next -&gt;</button>
<button onclick="tiff0.GoToPageSpecial(2)">Last -&gt;|</button>
<button onclick="querypage()">Query</button>
<br>
<table border="0" cellpadding="0" cellspacing="0">
<tbody><tr>
<td>Orientation:&nbsp;</td>
<td><button onclick="tiff0.SetValue(1,4)">Left</button></td>

<td align="center">
<button onclick="tiff0.SetValue(1,1)">Up</button><br>
<button onclick="tiff0.SetValue(1,3)">Down</button>
</td>

<td><button onclick="tiff0.SetValue(1,2)">Right</button></td>

<td>&nbsp;<button onclick="tiff0.SetValue(1,6)">&lt;- Left</button>
<button onclick="tiff0.SetValue(1,5)">Right -&gt;</button>
<button onclick="queryorient()">Query</button>
</td></tr></tbody></table>

Negative:&nbsp;
<button onclick="tiff0.SetValue(2,0)">Nonneg</button>
<button onclick="tiff0.SetValue(2,1)">Neg</button>
<button onclick="tiff0.SetValue(2,2)">Toggle</button>
<button onclick="queryneg()">Query</button>
<br>

Resample:&nbsp;
<button onclick="tiff0.SetValue(3,0)">Off</button>
<button onclick="tiff0.SetValue(3,1)">On</button>
<button onclick="queryresample()">Query</button>
<br>

Mouse mode:&nbsp;
<button onclick="tiff0.SetValue(4,2)">Pointer</button>
<button onclick="tiff0.SetValue(4,0)">Zoom</button>
<button onclick="tiff0.SetValue(4,1)">Pan</button>
<button onclick="querymousemode()">Query</button>
<br>

Size mode:&nbsp;
<button onclick="tiff0.SetValue(5,3)">Best</button>
<button onclick="tiff0.SetValue(5,1)">Width</button>
<button onclick="tiff0.SetValue(5,2)">Height</button>
<button onclick="tiff0.SetValue(5,0)">Fixed</button>
<button onclick="querysizemode()">Query</button>
<br>

Fixed size:&nbsp;
<button onclick="tiff0.SetValue(6,5)">5</button>
<button onclick="tiff0.SetValue(6,10)">10</button>
<button onclick="tiff0.SetValue(6,17)">17</button>
<button onclick="tiff0.SetValue(6,25)">25</button>
<button onclick="tiff0.SetValue(6,33)">33</button>
<button onclick="tiff0.SetValue(6,50)">50</button>
<button onclick="tiff0.SetValue(6,70)">70</button>
<button onclick="tiff0.SetValue(6,100)">100</button>
<button onclick="tiff0.SetValue(6,200)">200</button>
<button onclick="queryfixedsize()">Query</button>
<br>

Miscellaneous:&nbsp;
<button onclick="tiff0.Zoom(1)">Zoom</button>
<button onclick="tiff0.AboutBox()">About</button>
<button onclick="queryversion()">Version</button>
<button onclick="querystate();">State</button>
<button onclick="tiff0.Print(0)">Print</button>
<br>

Current orientation: <input id="orient_console" size="4" readonly=""> (demonstration of
event handling)



</body><iframe id="tmp_downloadhelper_iframe" style="display: none;"></iframe></html>